/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author taticay
 */
@Entity
@Table(name = "in_inventory")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InInventory.findAll", query = "SELECT i FROM InInventory i"),
    @NamedQuery(name = "InInventory.findByIdInventoty", query = "SELECT i FROM InInventory i WHERE i.idInventory = :idInventory"),
    @NamedQuery(name = "InInventory.findByIdOpCen", query = "SELECT i FROM InInventory i WHERE i.idOpCen = :idOpCen"),
    @NamedQuery(name = "InInventory.findByIdPos", query = "SELECT i FROM InInventory i WHERE i.idPos = :idPos"),
    @NamedQuery(name = "InInventory.findByIdPerson", query = "SELECT i FROM InInventory i WHERE i.idPerson = :idPerson"),
    @NamedQuery(name = "InInventory.findBySku", query = "SELECT i FROM InInventory i WHERE i.sku = :sku"),
    @NamedQuery(name = "InInventory.findBySkuStatusInProcess", query = "SELECT i FROM InInventory i WHERE i.sku = :sku and i.status = 1 and i.inProcess = 0"),
//    @NamedQuery(name = "InInventory.findByIdBrand", query = "SELECT i FROM InInventory i WHERE i.idBrand = :idBrand"),
//    @NamedQuery(name = "InInventory.findByIdLine", query = "SELECT i FROM InInventory i WHERE i.idLine = :idLine"),
//    @NamedQuery(name = "InInventory.findByIdClass", query = "SELECT i FROM InInventory i WHERE i.idClass = :idClass"),
    @NamedQuery(name = "InInventory.findByIdCatalog", query = "SELECT i FROM InInventory i WHERE i.idCatalog = :idCatalog"),
    @NamedQuery(name = "InInventory.findByIdColor", query = "SELECT i FROM InInventory i WHERE i.idColor = :idColor"),
    @NamedQuery(name = "InInventory.findByIdSize", query = "SELECT i FROM InInventory i WHERE i.idSize = :idSize"),
    @NamedQuery(name = "InInventory.findByInDate", query = "SELECT i FROM InInventory i WHERE i.inDate = :inDate"),
    @NamedQuery(name = "InInventory.findByDescription", query = "SELECT i FROM InInventory i WHERE i.description = :description"),
    @NamedQuery(name = "InInventory.findByPurchasePrice", query = "SELECT i FROM InInventory i WHERE i.purchasePrice = :purchasePrice"),
    @NamedQuery(name = "InInventory.findBySalePrice", query = "SELECT i FROM InInventory i WHERE i.salePrice = :salePrice"),
    @NamedQuery(name = "InInventory.findByModDate", query = "SELECT i FROM InInventory i WHERE i.modDate = :modDate"),
    @NamedQuery(name = "InInventory.findByInProcess", query = "SELECT i FROM InInventory i WHERE i.inProcess = :inProcess"),
    @NamedQuery(name = "InInventory.findByStatus", query = "SELECT i FROM InInventory i WHERE i.status = :status")})
public class InInventory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_inventory")
    private Integer idInventory;
    @OneToOne
    @JoinColumn(name="id_op_cen")
    private InOpCen idOpCen;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_pos")
    private int idPos;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_person")
    private int idPerson;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 11)
    @Column(name = "sku")
    private String sku;
     @OneToOne
       @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false)
    })
    private InBrand idBrand;
    @OneToOne
       @JoinColumns({
        @JoinColumn(name="id_line", referencedColumnName="id_line", updatable = false, insertable = false),
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false)
    })
    private InLine idLine;
     @OneToOne
      @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false),
        @JoinColumn(name="id_line", referencedColumnName="id_line",  updatable = false, insertable = false),
        @JoinColumn(name="id_class", referencedColumnName="id_class",  updatable = false, insertable = false)
    })
    private InClass idClass;

      @OneToOne
      @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand"),
        @JoinColumn(name="id_line", referencedColumnName="id_line"),
        @JoinColumn(name="id_class", referencedColumnName="id_class"),
        @JoinColumn(name="id_catalog", referencedColumnName="id_catalog")
    })
    private InCatalog idCatalog;
    @OneToOne
    @JoinColumn(name = "id_color")
    private InColor idColor;
    @OneToOne
    @JoinColumn(name = "id_size")
    private InSize idSize;
    @Basic(optional = false)
    @NotNull
    @Column(name = "in_date")
    @Temporal(TemporalType.DATE)
    private Date inDate;
    @Size(max = 100)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "purchase_price")
    private float purchasePrice;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "sale_price")
    private Float salePrice;
    @Column(name = "retail_price")
    private Float retailPrice;
    @Column(name = "mod_date")
    @Temporal(TemporalType.DATE)
    private Date modDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "in_process")
    private boolean inProcess;
    @Lob
    @Column(name = "image")
    private byte[] image;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;

    public InInventory() {
    }

    public InInventory(Integer idInventario) {
        this.idInventory = idInventario;
    }

    public InInventory(Integer idInventario, InOpCen idOpCen, int idPos, int idPerson, String sku, InBrand idBrand, InLine idLine, InClass idClass,InCatalog idCatalog, InColor idColor, InSize idSize, Date inDate, float purchasePrice, boolean inProcess, boolean status) {
        this.idInventory = idInventario;
        this.idOpCen = idOpCen;
        this.idPos = idPos;
        this.idPerson = idPerson;
        this.sku = sku;
        this.idBrand = idBrand;
        this.idLine = idLine;
        this.idClass = idClass;
        this.idCatalog = idCatalog;
        this.idColor = idColor;
        this.idSize = idSize;
        this.inDate = inDate;
        this.purchasePrice = purchasePrice;
        this.inProcess = inProcess;
        this.status = status;
    }

    public Integer getIdInventario() {
        return idInventory;
    }

    public void setIdInventario(Integer idInventario) {
        this.idInventory = idInventario;
    }

    public InOpCen getIdOpCen() {
        return idOpCen;
    }

    public void setIdOpCen(InOpCen idOpCen) {
        this.idOpCen = idOpCen;
    }

    public int getIdPos() {
        return idPos;
    }

    public void setIdPos(int idPos) {
        this.idPos = idPos;
    }

    public int getIdPerson() {
        return idPerson;
    }

    public void setIdPerson(int idPerson) {
        this.idPerson = idPerson;
    }

    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public InBrand getIdBrand() {
        return idBrand;
    }

    public void setIdBrand(InBrand idBrand) {
        this.idBrand = idBrand;
    }

    public InLine getIdLine() {
        return idLine;
    }

    public void setIdLine(InLine idLine) {
        this.idLine = idLine;
    }

    public InClass getIdClass() {
        return idClass;
    }

    public void setIdClass(InClass idClass) {
        this.idClass = idClass;
    }

    public InCatalog getIdCatalog() {
        return idCatalog;
    }

    public void setIdCatalog(InCatalog idCatalog) {
        this.idCatalog = idCatalog;
    }

    public InColor getIdColor() {
        return idColor;
    }

    public void setIdColor(InColor idColor) {
        this.idColor = idColor;
    }

    public InSize getIdSize() {
        
        return idSize;
    }

    public void setIdSize(InSize idSize) {
        this.idSize = idSize;
    }

    public Date getInDate() {
        return inDate;
    }

    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public float getPurchasePrice() {
        return purchasePrice;
    }

    public void setPurchasePrice(float purchasePrice) {
        this.purchasePrice = purchasePrice;
    }

    public Float getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(Float salePrice) {
        this.salePrice = salePrice;
    }

    public Float getRetailPrice() {
        return retailPrice;
    }

    public void setRetailPrice(Float retailPrice) {
        this.retailPrice = retailPrice;
    }

    public Date getModDate() {
        return modDate;
    }

    public void setModDate(Date modDate) {
        this.modDate = modDate;
    }

    public boolean getInProcess() {
        return inProcess;
    }

    public void setInProcess(boolean inProcess) {
        this.inProcess = inProcess;
    }

    public byte[] getImage() {
        return image;
    }

    public void setImage(byte[] image) {
        this.image = image;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInventory != null ? idInventory.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InInventory)) {
            return false;
        }
        InInventory other = (InInventory) object;
        if ((this.idInventory == null && other.idInventory != null) || (this.idInventory != null && !this.idInventory.equals(other.idInventory))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.InInventory[ idInventario=" + idInventory + " ]";
    }
    
}
